AddressUtil = {
	create: function(id) {
		var type = "address";
		var uid = Math.uuid();

		var c = null;
		if (Util.isNotEmpty(id)) {
			c = Vari.fieldMap.get(id);
		}
		var f = (Vari.tpl.filterProperty('type', type)[0]);
		var n = App.FieldVo.create(f);

		Ember.mixin(n, {
			uid: uid
		});
		
		if (Util.isNotEmpty(c)) {
			var pos = Vari.frm.get("fields").indexOf(c) + 1;
			Vari.frm.get("fields").insertAt(pos, n);
		} else {
			Vari.frm.get("fields").pushObject(n);
		}		
		
		Vari.fieldMap.set(uid, n);		
		
		AddressUtil.show(n);		
	},
	show: function(fieldContext) {
		var textView = App.AddressEditView.create();
		var containerView = Em.View.views['form_canvas_view'];
		containerView.get('childViews').pushObject(textView);

		textView.set("context", fieldContext);
		
		containerView.get('childViews').sort(function(a, b) {
			return a.get("context").get("indexx") - b.get("context").get("indexx");			
		});
	},

};